// import { mock } from 'mockjs'
import { MockMethod } from 'vite-plugin-mock'
export default [
  {
    url: '/api/getUserInfo',
    method: 'get',
    response: ({ headers }) => {
      const { authorization } = headers
      const userId = decodeURIComponent(authorization).split(' ')[1]
      return {
        code: 200,
        message: '成功',
        data: {
          userId,
          userName: userId === 'ADMIN' ? '管理员' : userId,
          avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
          roles: [userId === 'ADMIN' ? 'ADMIN' : 'USER'],
          perms: [
            'sys:menu:delete',
            'sys:dept:edit',
            'sys:dict_type:add',
            'sys:dict:edit',
            'sys:dict:delete',
            'sys:dict_type:edit',
            'sys:menu:add',
            'sys:user:add',
            'sys:role:edit',
            'sys:dept:delete',
            'sys:user:edit',
            'sys:user:delete',
            'sys:user:reset_pwd',
            'sys:dept:add',
            'sys:role:delete',
            'sys:dict_type:delete',
            'sys:menu:edit',
            'sys:dict:add',
            'sys:role:add'
          ]
        }
      }
    }
  }
] as MockMethod[]
